package main

import (
	"affairs/controller"
	"affairs/tool"
	"github.com/gin-gonic/gin"
)

func main()  {

	cfg, err := tool.ParseConfig("./config/app.json")

	if err != nil {
		panic(err.Error())
	}

	_, err = tool.OrmEngine(cfg)

	if err != nil {
		panic(err)
	}

	app := gin.Default()

	userRouter(app)

	app.Run(cfg.AppHost + ":" + cfg.AppPort)
}

func userRouter(router *gin.Engine) {
	new(controller.UserController).Router(router)
}